<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title>同步LDAP用户</title>
        <meta name="renderer" content="webkit">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
        <link rel="stylesheet" href="__PUBLIC__/layui/css/layui.css"  media="all">
        <link rel="stylesheet" href="__PUBLIC__/font-awesome/css/font-awesome.min.css" media="all" />
        <link rel="stylesheet" href="__CSS__/admin.css"  media="all">
    </head>
    <body style="padding:10px;">
        <div class="tplay-body-div">
            <fieldset class="layui-elem-field layui-field-title" style="margin-top: 30px;">
                <legend>同步LDAP用户到本地系统</legend>
            </fieldset>

            <div>      
                <button id="sync" type="button" class="layui-btn layui-btn-radius">同步用户</button>            
            </div>
        </div>
        <script src="__PUBLIC__/layui/layui.js"></script>
        <script src="__PUBLIC__/jquery/jquery.min.js"></script>
        <script type="text/javascript">
            layui.use(['layer', 'form'], function () {
                var layer = layui.layer,
                        $ = layui.jquery,
                        form = layui.form;
                $('#sync').click(function () {
                    $.ajax({
                        url: "{:url('admin/ldapuser/sync')}",
                        success: function (res) {
                            layer.msg(res.msg);
                            if (res.code == 1) {
                                setTimeout(function () {
                                    location.href = res.url;
                                }, 1500)
                            }
                        }
                    })
                });
            });
        </script>
    </body>
</html>